package com.ruoyi.recipe.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recipe.mapper.RecipeCollectMapper;
import com.ruoyi.recipe.domain.RecipeCollect;
import com.ruoyi.recipe.service.IRecipeCollectService;
import com.ruoyi.common.core.text.Convert;

/**
 * 食谱收藏Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-23
 */
@Service
public class RecipeCollectServiceImpl implements IRecipeCollectService 
{
    @Autowired
    private RecipeCollectMapper recipeCollectMapper;

    /**
     * 查询食谱收藏
     * 
     * @param userId 食谱收藏主键
     * @return 食谱收藏
     */
    @Override
    public RecipeCollect selectRecipeCollectByUserId(Long userId)
    {
        return recipeCollectMapper.selectRecipeCollectByUserId(userId);
    }

    /**
     * 查询食谱收藏列表
     * 
     * @param recipeCollect 食谱收藏
     * @return 食谱收藏
     */
    @Override
    public List<RecipeCollect> selectRecipeCollectList(RecipeCollect recipeCollect)
    {
        return recipeCollectMapper.selectRecipeCollectList(recipeCollect);
    }

    /**
     * 新增食谱收藏
     * 
     * @param recipeCollect 食谱收藏
     * @return 结果
     */
    @Override
    public int insertRecipeCollect(RecipeCollect recipeCollect)
    {
        return recipeCollectMapper.insertRecipeCollect(recipeCollect);
    }

    /**
     * 修改食谱收藏
     * 
     * @param recipeCollect 食谱收藏
     * @return 结果
     */
    @Override
    public int updateRecipeCollect(RecipeCollect recipeCollect)
    {
        return recipeCollectMapper.updateRecipeCollect(recipeCollect);
    }

    /**
     * 批量删除食谱收藏
     * 
     * @param userIds 需要删除的食谱收藏主键
     * @return 结果
     */
    @Override
    public int deleteRecipeCollectByUserIds(String userIds)
    {
        return recipeCollectMapper.deleteRecipeCollectByUserIds(Convert.toStrArray(userIds));
    }

    /**
     * 删除食谱收藏信息
     * 
     * @param userId 食谱收藏主键
     * @return 结果
     */
    @Override
    public int deleteRecipeCollectByUserId(Long userId)
    {
        return recipeCollectMapper.deleteRecipeCollectByUserId(userId);
    }

    @Override
    public int deleteRecipeCollect(RecipeCollect recipeCollect) {
        return recipeCollectMapper.deleteRecipeCollect(recipeCollect);
    }
}
